load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel/go:go_test.bzl", "go_test")

go_library(
    name = "initserver",
    srcs = ["initserver.go"],
    importpath = "github.com/edgelesssys/constellation/v2/bootstrapper/internal/initserver",
    visibility = ["//bootstrapper:__subpackages__"],
    deps = [
        "//bootstrapper/initproto",
        "//bootstrapper/internal/addresses",
        "//bootstrapper/internal/journald",
        "//internal/atls",
        "//internal/attestation",
        "//internal/constants",
        "//internal/crypto",
        "//internal/file",
        "//internal/grpc/atlscredentials",
        "//internal/grpc/grpclog",
        "//internal/kms/kms",
        "//internal/kms/setup",
        "//internal/logger",
        "//internal/nodestate",
        "//internal/role",
        "//internal/versions/components",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//keepalive",
        "@org_golang_google_grpc//status",
        "@org_golang_x_crypto//bcrypt",
        "@org_golang_x_crypto//ssh",
    ],
)

go_test(
    name = "initserver_test",
    srcs = ["initserver_test.go"],
    embed = [":initserver"],
    # keep
    pure = "on",
    # keep
    race = "off",
    deps = [
        "//bootstrapper/initproto",
        "//internal/atls",
        "//internal/attestation/variant",
        "//internal/constants",
        "//internal/crypto/testvector",
        "//internal/file",
        "//internal/kms/setup",
        "//internal/kms/uri",
        "//internal/logger",
        "//internal/versions/components",
        "@com_github_spf13_afero//:afero",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_x_crypto//bcrypt",
        "@org_golang_x_crypto//ssh",
        "@org_uber_go_goleak//:goleak",
    ],
)
